package com.mo.design.pattern.behavior.mediator;

import java.util.Timer;
import java.util.TimerTask;

public class TimerTest {

    //  定时器执行输出，定时器相当于中间调度者

    public static void main(String[] args) {
        Timer timer = new Timer();
        timer.schedule(new TimerTask() {
            int i = 0;
            @Override
            public void run() {
                System.out.println(i += 2);
            }
        }, 1000, 1000);
    }
}
